<div class="indexWidth">
    <button type="button" class="btn btn-info mainButtonRight"><a
            href="javascript:takeout.openMenu('${ctxPath!}/adv/list', null)" class="mianAcolor">返回</a></button>
    <div class="sectionTitle">
        广告设置
        <hr>
    </div>
    <form id="advForm" action="${ctxPath!}/adv/save" method="POST" class="form-horizontal"
          enctype="multipart/form-data">
        <input type="hidden" id="id" name="adv.id" class="mainSetWidth" value="${adv.id!}"/>

        <div class="articleFormLabel">
            <label class="mainSetConsistentWidth">性别：</label>
            <#dictTag val="${adv.gender!}" type="select" group="sex"  pname="adv.gender" defaultNumber="1"></#dictTag>
        </div>

        <div id="tab" class="btn-group" data-toggle="buttons-radio" style="margin-left: 100px">
            <a href="#fileimage" class="btn btn-large btn-info  active" data-toggle="tab">选择文件</a>
            <a href="#htmlimage" class="btn btn-large btn-info" data-toggle="tab">填写网址</a>
        </div>
        <div class="tab-content" style="margin-top: 10px">
            <div class="tab-pane " id="fileimage">
                <div class="articleFormLabel" style="display: flex;align-items:center;">
                    <label class="mainSetConsistentWidth">封面图片：</label>
                    <input type="file" id="grouping" name="img" class="mainSetWidth">
                    <a href="${adv.img!}" target="_blank" style="margin-left: 10px;">查看图片(图片大小无限制)</a>
                </div>
            </div>
            <div class="tab-pane active" id="htmlimage">
                <div class="articleFormLabel" style="display: flex;align-items:center;">
                    <label class="mainSetConsistentWidth">封面图片：</label>
                    <input type="text" name="adv.img" target="_blank" style="margin-top: 4px" class="mainSetWidth"
                           value="${adv.img!}" placeholder=""/>
                </div>
            </div>
        </div>


        <div class="articleFormLabel">
            <label class="mainSetConsistentWidth">类别：</label>
            <#oneToManyTag val="${adv.categoryid!}" type="select" table="category" columnName="name" class="mainSetWidth"
                    pname="adv.categoryid" defaultNumber="1" ></#oneToManyTag>
        </div>

        <div class="articleFormLabel">
            <label class="mainSetConsistentWidth">名称：</label>
            <input type="text" name="adv.title" class="mainSetWidth" value="${adv.title!}" placeholder=""/>
        </div>

        <div class="articleFormLabel">
            <label class="mainSetConsistentWidth">APPID：</label>
            <input type="text" name="adv.wxappid" class="mainSetWidth" value="${adv.wxappid!}" placeholder=""/>
        </div>
        <div class="articleFormLabel">
            <label class="mainSetConsistentWidth">APPURL：</label>
            <input type="text" name="adv.wxppurl" class="mainSetWidth" value="${adv.wxppurl!}" placeholder=""/>
        </div>

        <div class="form-group">
            <button style="margin-left: 100px;width:95px;" class="btn btn-info articleFormButton" type="button"
                    onclick="takeout.ajaxFormMainPanel('advForm')">保存
            </button>
        </div>

    </form>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#id_sex").change(function () {
//根据index获取选中项的value值
                var categoryid="${categoryid!}";
                var val = $(this).children('option:selected').val();
                if(categoryid!=""){
                    var result = $.ajax({
                        method: "GET",
                        url: "${ctxPath!}/adv/editByGender?categoryid=${categoryid!}&genderInt=" + val,
                        async: false
                    }).responseText;
                    $("#manage_content").html(result);
                }

            });
        });

    </script>

